<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>plugin</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
    <div id="root"></div>
    <script>
        const myplugin={
            install(app,options){
                app.provide('name','jj')
                app.mixin({
                    mounted(){
                        console.log('666')
                    }
                })
                app.directive('focus',{
                    mounted(el){
                        el.focus()
                    }
                })
                app.config.globalProperties.$sayHello='hello world'
            }
        }
        const app=Vue.createApp({
            template:`<gu/>
            `
        })
        app.component('gu',{
            inject:['name'],
            mounted(){
                console.log(this.$sayHello)
            },
            template:`<div>{{name}}
                <input v-focus/>
                </div>
            `
        })
        app.use(myplugin)
        app.mount('#root')
    </script>
</body>
</html>